<?php

namespace App\Http\Controllers\home;

use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class OrderController extends Controller
{
    //查询榜单信息,默认显示日排行
	  public function getDay(Request $request){

          //搜索总条数
          $num = DB::table('order')
          ->count();
            //联表查询排名显示视频

            $order = DB::table('order')
                ->join('video', 'video.id', '=', 'order.vid')
                ->orderby('order.day','desc')
                ->get();

             //搜索总条数
          $num = DB::table('order')
          ->count();
            return view('home/numlist',['order'=>$order,'num'=>$num]);

      }

      //查询榜单信息,默认显示周排行
      public function getWeek(Request $request){

        $order = DB::table('order')
            ->join('video', 'video.id', '=', 'order.vid')
            ->orderby('order.week','desc')
            ->get();
                //搜索总条数
          $num = DB::table('order')
          ->count();
           
        return view('home/numlist',['order'=>$order,'num'=>$num]);
      }

      public function getMonth(Request $request){

        $order = DB::table('order')
            ->join('video', 'video.id', '=', 'order.vid')
            ->orderby('order.month','desc')
            ->get();
                //搜索总条数
          $num = DB::table('order')
          ->count();
           
        return view('home/numlist',['order'=>$order,'num'=>$num]);
      }
      //查询榜单信息,默认显示季排行
      public function getSeason(Request $request){

        $order = DB::table('order')
            ->join('video', 'video.id', '=', 'order.vid')
            ->orderby('order.season','desc')
            ->get();

             $num = DB::table('order')
          ->count();
        return view('home/numlist',['order'=>$order,'num'=>$num]);
      }

       //查询榜单信息,默认显示年排行
      public function getYear(Request $request){

       $order = DB::table('order')
           ->join('video', 'video.id', '=', 'order.vid')
           ->orderby('order.year','desc')
           ->get();

            $num = DB::table('order')
          ->count();
        return view('home/numlist',['order'=>$order,'num'=>$num]);
      }
}
